var emptyform = {
    etyma:'',
    lv:1,
    eg:[],
    explanation:'',
    remarks:[]
};
const state ={
    form:null
};

const mutations ={
    setForm(state,formdata){
        state.form = formdata;
        console.log(state.form);
    },
    resetForm(state){
        emptyform = {
            etyma:'',
            lv:1,
            eg:[],
            explanation:'',
            remarks:[]
        };
        state.form = null;
    }
};

const actions = {
    setForm(context,formdata){
        console.log('setform action');
        console.log(formdata);
        context.commit('setForm',formdata);
    },
    resetForm(context){
        context.commit('resetForm');
    }
};

const getters = {
    form:state=>{
        if(!state.form)
            state.form = emptyform;
        return state.form;
    }
};
export default {
    namespaced:true,
    state,
    mutations,
    actions,
    getters
}